package com.daybook.mapper;


import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import com.daybook.pojo.BNumber;
import com.daybook.pojo.Books;
import com.daybook.pojo.BooksAndCategory;

//书籍操作dao
public interface BooksMapper {
	
	
	/********************用户模块********************/
	//1.查询最新上架的书籍
	 List<Books> selectBooksByNewTime(@Param(value = "count") int count);
	//2.销量排行榜
	List<Books> selectBooksByNewSaleNum(@Param(value = "count") int count);
	//3.主页按类别名查询
	List<Books> selectBooksByCname(@Param(value = "cname")String came);
	//4.分页条件查询
	List<Books> selectBooksByCondition(Map<String, Object> map);
	//4.2 分页条件数量查询
	int selectCountByCondition(Map<String, Object> map);
	//5 根据书籍ID查询
	BooksAndCategory selectBookByBid(@Param(value = "bid")int id);
	//6.修改书的数量
	int updateBookByNumber(@Param(value = "bList")List<BNumber> bList);
	/********************管理员模块********************/
	 // 添加书籍
	 int addNewBook(Books books);
	 //查询所有书籍
	List<BooksAndCategory> selectAllBookByPage(Map<String, Object> map);

	//查询所有书籍数量
	 int getBooksCount(Map<String, Object> map);
	 //修改书的状态
	 int updateBookState(@Param(value = "bid")int bid,@Param(value = "bstate")int bstate);
	 //更新数据信息
	 int updateBookInfo(@Param(value = "book")Books books);
	 //编号验证
	 int getBnum(@Param(value = "bnum")String bnum);
	 //统计
	List<Books> selectTopBooks();
}
